package com.hqx.oop.datatransmit;

public class ValueTransferTest {
    public static void main(String[] args) {
        int m = 10;
        int n = 20;

//        int temp = m;
//        m = n;
//        n = temp;
//        System.out.println("m="+m+"\t"+"n="+n);
//        new ValueTransferTest().swap(m,n);
//        System.out.println("m="+m+"\t"+"n="+n);

        Data data = new Data();
        new ValueTransferTest().swap(data);
        System.out.println(data.m+"\t"+data.n);

    }


    public void swap(int m,int n) {
        int temp = m;
        m = n;
        n = temp;

        System.out.println("m="+m+"\t"+"n="+n);
    }

    public void swap(Data data) {
        int temp = data.m;
        data.m = data.n;
        data.n = temp;
        System.out.println(data.m+"\t"+data.n);
    }


}
class Data {
    int m = 10;
    int n = 20;
}
